      Subroutine Read_RigidBlock                               
      
      Use Constant,          ONLY: Icout,Icdat,Icmes,Seper
      Use Global_Variables,  ONLY: Nnode,Lnodt
    
      Implicit None

!.... Read The Nodes For The Rigid Block And Check The Dof Of Each Nodes
!.... You Could Add A Force To The Rigid Block (At Node Npoin)
!.... But Not A Fixed Boundary Condition

!.... Output Variables
!     Integer Lnodt(Nnode)
!.... Local Variables
      Integer Istat,Itemp,Inode
      Character Ttemp*80,Chrin*16,Chrea*16
	  
	  Allocate(Lnodt(Nnode))
      
!.... Read In The Title

      Read (Icmes,'(A)',Err=3100,End=3200,Iostat=Istat)Ttemp
      Ttemp=Adjustl(Ttemp)
      Itemp=Max(Len_Trim(Ttemp),1)
      If (Ttemp(1:7).Ne.'GETRIG:') Then
         Write(Icout,*)Ttemp(1:Itemp)
         Call Warning_Message('Read_RigidBlock-11: Please Begin The Title With Getrig:'//' For Input Checking Purpose')         
      End If
      
!.... Read In The Nodes
!.... Put All Zero If No Rigid Block
      Read (Icmes,*,Err=3100,End=3200,Iostat=Istat)(Lnodt(Inode),Inode=1,Nnode)      

 2002 Format(' Rigid Block (Plotting) Nodes:',/,16i5)
!.... Could Use Polygon_Property To Calculate The Centroid, Area And Second
!     Moment Of Area, Then The Only Input Required Will Be Density
      Return
      
!.... Error Condition
 3100 Continue
      Call Integer2String(Chrin,Icmes)
      Call Integer2String(Chrea,Istat)
      Call Error_Message('Read_RigidBlock-5: Error On Channel:'//Chrin//' Iostat:'//Chrea)      
      Return
 3200 Continue
      Call Integer2String(Chrin,Icmes)
      Call Integer2String(Chrea,Istat)
      Call Error_Message('Read_RigidBlock-6: End Of File On Channel:'//Chrin//' Iostat:'//Chrea)      
      Return
      End
      
      
      Subroutine Get_Rigid_Block_Properties(Coord)                                            
      
      Use Constant,          ONLY: Icout,Icdat,Seper,Ndime
      Use Global_Variables,  ONLY: Nnode,Rigdx,Rigdy,Rigdm,Rigdi,Rigbx,Rigby,Npoin,Lnodt,Rigid
      
      Implicit None
      Integer Istat
!.... Input Variables
      Integer Inode,Jnode
      Double Precision Areax,Areay
      Double Precision Coord(Ndime,Npoin),Dtemp
      Double Precision Xlcod(18),Ylcod(18)
!     Character Ttemp*80
      Character Chrin*16,Chrea*16
      
!.... Read In The Property Of The Rigid Block
      Read (Icdat,*,Err=3300,End=3400,Iostat=Istat)Rigdx,Rigdy,Rigdm,Rigdi,Rigbx,Rigby       
      
      If (Rigdm.Lt.0.0D0) Then
         Jnode=0
         Do Inode=1,Nnode
            If (Lnodt(Inode).Eq.0) Cycle
            Jnode=Jnode+1
            Xlcod(Jnode)=Coord(1,Lnodt(Jnode))
            Ylcod(Jnode)=Coord(2,Lnodt(Jnode))          
         End Do
         If (Jnode.Eq.0) Call Termination('Get_Rigid_Block_Properties-1: No Rigid Block Node'//' Definition')         
         Call Polygon_Property(Xlcod,Ylcod,Jnode,Rigdx,Rigdy,Dtemp,Rigdi,Areax,Areay)         
         Rigdi=-Rigdm*Rigdi
         If (Rigdi.Le.0.0D0) Call Termination('Get_Rigid_Block_Properties-2: Negative Rigdi')
         Rigdm=-Rigdm*Dtemp
         If (Rigdm.Le.0.0D0) Call Termination('Get_Rigid_Block_Properties-3: Negative Rigdm')       
      End If
      If (Rigid) Then
         Write(Icout,*)'Get_Rigid_Block_Properties: Coordinate For Rigid Block'
         Coord(1,Npoin)=Rigdx
         Coord(2,Npoin)=Rigdy
      End If

 2001 Format(' Ridgx:',1pe14.6,' Rigdy:',1pe14.6,' Rigdm:',1pe14.6   &
          ,/,' Rigdi:',1pe14.6,' Rigbx:',1pe14.6,' Rigby:',1pe14.6)
 2002 Format(' Rigid Block Node:',I4,' Node:',I4,' Coord:',2e12.4)
      
      Return
      
 3300 Continue
      Call Integer2String(Chrin,Icdat)
      Call Integer2String(Chrea,Istat)
      Call Error_Message('Get_Rigid_Block_Properties-7: Error On Channel:'//Chrin//' Iostat:'//Chrea)      
      Return
 3400 Continue
      Call Integer2String(Chrin,Icdat)
      Call Integer2String(Chrea,Istat)
      Call Error_Message('Get_Rigid_Block_Properties-8: End Of File On Channel:'//Chrin//' Iostat:'//Chrea)      
      Return
      End